package javastring;

public class StringEquals {
	public static void main(String[] args) {
		String str1 = "abc";
		String str2 = "abc";
		String str3 = new String("abc");
		String str4 = new String("abc");
		System.out.println(str1);
		System.out.println(str2);
		System.out.println(str3);
		System.out.println("--==--");
		System.out.println(str1 == str2);
		System.out.println(str2 == str3);
		System.out.println(str3 == str4);
		System.out.println("--equals--");
		System.out.println(str1.equals(str2));
		System.out.println(str2.equals(str3));
		System.out.println(str3.equals(str4));
		System.out.println("--class--");
		System.out.println(str1.getClass().getName() + "@" + Integer.toHexString(str1.hashCode()));
		System.out.println(str2.getClass().getName() + "@" + Integer.toHexString(str2.hashCode()));
		System.out.println(str3.getClass().getName() + "@" + Integer.toHexString(str3.hashCode()));
		System.out.println(str4.getClass().getName() + "@" + Integer.toHexString(str4.hashCode()));
		
	}
}
